package cn.cvs.service.impl;

import cn.cvs.dao.UserMapper;
import cn.cvs.entity.User;
import cn.cvs.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;
    @Override
    public User login(String username, String password) {
        User user = userMapper.selectByUsername(username);
        if (user==null){
            return null;
        }

        // 比较密码
        if (password.equals(user.getPassword())){
            return user;
        }

        return null;
    }
}
